﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IMark
{
    public partial class ThanhToanStep2 : System.Web.UI.Page
    {
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                KHACH_HANG kh = Session["User"] as KHACH_HANG;
                txtHoTen.Value = kh.HoTen;
                txtSoDienThoai.Value = kh.DienThoai;
                txtDiaChi.Value = kh.DiaChi;
                txtEmail.Value = kh.Email;
                //txtHoTen.Enabled = false;
                txtHoTen.Disabled = true;
                txtEmail.Disabled = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                string HoTen = string.Empty;
                string DiaChi = string.Empty;
                string SoDienThoai = string.Empty;
                string Email = string.Empty;
                if (Request.QueryString["ctl00$ContentPlaceHolder1$txtSoDienThoai"] != null)
                {
                    
                    DiaChi = Request.QueryString["ctl00$ContentPlaceHolder1$txtDiaChi"].ToString();
                    SoDienThoai = Request.QueryString["ctl00$ContentPlaceHolder1$txtSoDienThoai"].ToString();
                    
                    if (Session["User"] != null)
                    {
                        KHACH_HANG kh = Session["User"] as KHACH_HANG;
                        kh.DiaChi = DiaChi;
                        kh.DienThoai = SoDienThoai;
                    }
                    else
                    {
                        HoTen = Request.QueryString["ctl00$ContentPlaceHolder1$txtHoTen"].ToString();
                        Email = Request.QueryString["ctl00$ContentPlaceHolder1$txtEmail"].ToString();
                        KHACH_HANG kh = new KHACH_HANG();
                        kh.HoTen = HoTen;
                        kh.DiaChi = DiaChi;
                        kh.DienThoai = SoDienThoai;
                        kh.Email = Email;
                        Session["kh"] = kh;
                    }
                    Response.Redirect("ThanhToanStep3.aspx");
                }
                //if (Request.QueryString["ctl00$ContentPlaceHolder1$txtDiaChi"] != null)
                //{
                    
                //}
                //if (Request.QueryString["ctl00$ContentPlaceHolder1$txtSoDienThoai"] != null)
                //{
                    
                //}
                //if (Request.QueryString["ctl00$ContentPlaceHolder1$txtEmail"] != null)
                //{
                    
                //}
                
            }
            else
            {
                
            }
            
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //string user = txtHoTen.Text;
        }
    }
}